﻿Ext.define('Cps.view.dashboard.popup.Criteria', {
	extend: 'Ext.window.Window',
	alias: 'widget.Criteria',
	
	id: 'criteria',
	height: 350,
	width: 600,
	title: Cps.Locale.Criteria.title,
	closable: true,
	resizable: false,
	modal: true,
	layout: { type:'hbox', align: 'stretch'},
	items: [
		{
			xtype: 'form',
			flex: 1,
			border: false,
			bodyPadding: '5 20 5 20',
			items: [
				{
					xtype: 'combo',
					id: 'cbbDepositary',
					width: 543,
					fieldLabel: Cps.Locale.Criteria.field1,
					listeners: {
						beforerender: function() {
							this.store = Ext.create('Cps.store.Thirds', {
								params: getParam,
							});
							this.store.initData(true, this);
						},
						change: function() {
						  var store = this.store;
						  store.clearFilter();
						  store.filter({
							  property: 'ThirdName',
							  anyMatch: true,
							  value   : this.getValue()
						  });
						},
						expand: function() {
							var store = this.store;
							store.clearFilter();
							if (store.findRecord('ThirdName',Cps.Locale.Dashboard1.all) == null)
							{
								store.sort('ThirdName');
								store.sorters.removeAll();
								store.insert(0, { ThirdId: '0', ThirdName: Cps.Locale.Dashboard1.all});
							}
						},
						focus: function() {
							this.clearValue();
							this.expand();
						},
						blur: function() {
							if (this.getDisplayValue() == '')
								this.setValue(Cps.Locale.Dashboard1.all);
						}
					},
					name: 'Depositary',
					queryMode: 'local',
					displayField: 'ThirdName',
					valueField: 'ThirdId'
				},
				{
					xtype: 'fieldcontainer',
					fieldLabel: Cps.Locale.Criteria.field2,
					layout: 'hbox',
					items: [
						{
							xtype: 'hiddenfield',
							id: 'hdfClientId',
							name: 'ClientId',
							listeners: {
								afterrender: function() {
									setValueForm(this,'ClientId');
								}
							}
						},
						{
							xtype: 'textfield',
							maskRe: /([0-9]|')/,
							regex: /([0-9]|')/,
							regexText: Cps.Locale.Dashboard1.valid,
							id: 'txtClientCode',
							name: 'ClientCode',
							margin: '0 5 0 0',
							decimalSeperator: "'",
							flex: 1,
							listeners: {
								/*change: function() {
									var clientcode = this.getValue();
									clientcode= Ext.util.Format.number(clientcode, '0,000');
									clientcode = clientcode.replace(/[,|.]/g,"'");
									this.setValue(clientcode);
								},*/
								afterrender: function() {
									setValueForm(this,'ClientCode');
								},
								blur: function(field){
									if(this.getValue() == 0 || this.getValue() == '')
									{
										var ClientDisplay= Ext.getCmp('txtClientName');
										ClientDisplay.setValue(Cps.Locale.Dashboard1.all);
										this.setValue(0);
										return;
									}
									this.setRawValue(Ext.util.Format.number(this.getValue(), '0,000'));
								}
							}
						}, 
						{
							xtype: 'button',
							margin: '0 5 0 0',
							text: '',
							iconCls: 'iconSearch',
							handler: function () {
								popupSearch(3);
							},
						}, 
						{
							xtype: 'textfield',
							id: 'txtClientName',
							name: 'ClientName',
							readOnly: true,
							fieldStyle: 'background: #EDEDED;',
							margin: '0 5 0 0',
							flex: 2,
							listeners: {
								afterrender: function() {
									setValueForm(this,'ClientName');
								},
							}
						}
					]
				},
				{
					xtype: 'fieldcontainer',
					fieldLabel: Cps.Locale.Criteria.field3,
					layout: 'hbox',
					items: [
						{
							xtype: 'textfield',
							maskRe: /([0-9]|')/,
							regex: /([0-9]|')/,
							decimalSeperator: "'",
							regexText: Cps.Locale.Dashboard1.valid,
							id: 'txtPortfolioCode',
							name: 'PortfolioCode',
							margin: '0 5 0 0',
							flex: 1,
							listeners: {
								/*change: function() {
									if (this.getValue() == '')
										this.setValue(0);
								},*/
								afterrender: function() {
									setValueForm(this,'PortfolioCode');
								},
								blur: function(){
									if(this.getValue() == 0 || this.getValue() == '')
									{
										var PortfolioDisplay= Ext.getCmp('txtPortfolioName');
										PortfolioDisplay.setValue(Cps.Locale.Dashboard1.all);
										this.setValue(0);
										return;
									}
									this.setRawValue(Ext.util.Format.number(this.getValue(), '0,000'));
								}
							}
						}, 
						{
							xtype: 'button',
							margin: '0 5 0 0',
							text: '',
							iconCls: 'iconSearch',
							handler: function () {
								popupSearch(1);
							},
						}, 
						{
							xtype: 'textfield',
							id: 'txtPortfolioName',
							name: 'PortfolioName',
							readOnly: true,
							fieldStyle: 'background: #EDEDED;',
							margin: '0 5 0 0',
							flex: 2,
							listeners: {
								afterrender: function() {
									setValueForm(this,'PortfolioName');
								}
							}
						}
					]
				},
				{
					xtype: 'combo',
					id: 'cbbEmployee',
					width: 543,
					fieldLabel: Cps.Locale.Criteria.field7,
					listeners: {
						beforerender: function() {
							this.store = Ext.create('Cps.store.Employees');
							this.store.initData(true, this);
						},
						change: function() {
						  var store = this.store;
						  store.clearFilter();
						  store.filter({
							  property: 'EmployeeName',
							  anyMatch: true,
							  value   : this.getValue()
						  });
						},
						expand: function() {
							var store = this.store;
							store.clearFilter();
							if (store.findRecord('EmployeeName',Cps.Locale.Dashboard1.all) == null)
							{
								store.sort('EmployeeName');
								store.sorters.removeAll();
								store.insert(0, { EmployeeCode: '0', EmployeeName: Cps.Locale.Dashboard1.all});
							}
						},
						focus: function() {
							this.clearValue();
							this.expand();
						},
						blur: function() {
							if (this.getDisplayValue() == '')
								this.setValue(Cps.Locale.Dashboard1.all);
						}
					},
					name: 'Employee',
					queryMode: 'local',
					displayField: 'EmployeeName',
					valueField: 'EmployeeCode'
				},
				{
					xtype: 'combo',
					id: 'cbbPool',
					width: 543,
					fieldLabel: Cps.Locale.Criteria.field8,
					listeners: {
						beforerender: function() {
							this.store = Ext.create('Cps.store.Pools', {
								params: getParam,
							});
							this.store.initData(true, this);
						},
						change: function() {
						  var store = this.store;
						  store.clearFilter();
						  store.filter({
							  property: 'PoolName',
							  anyMatch: true,
							  value   : this.getValue()
						  });
						},
						expand: function() {
							var store = this.store;
							store.clearFilter();
							if (store.findRecord('PoolName',Cps.Locale.Dashboard1.all) == null)
							{
								store.sort('PoolName');
								store.sorters.removeAll();
								store.insert(0, { PoolCode: '0', PoolName: Cps.Locale.Dashboard1.all});
							}
						},
						focus: function() {
							this.clearValue();
							this.expand();
						},
						blur: function() {
							if (this.getDisplayValue() == '')
								this.setValue(Cps.Locale.Dashboard1.all);
						}
					},
					name: 'Pool',
					queryMode: 'local',
					displayField: 'PoolName',
					valueField: 'PoolCode'
				},
				{
					xtype: 'fieldcontainer',
					fieldLabel: Cps.Locale.Criteria.field9,
					layout: 'hbox',
					items: [
						{
							xtype: 'hiddenfield',
							id: 'hdfSecurityId',
							name: 'SecurityId',
							value: 0,
							listeners: {
								afterrender: function() {
									setValueForm(this,'SecurityId');
								}
							}
						},
						{
							xtype: 'textfield',
							id: 'txtSecurityCode',
							name: 'SecurityCode',
							margin: '0 5 0 0',
							flex: 1,
							listeners: {
								afterrender: function() {
									setValueForm(this,'SecurityCode');
								},
								blur: function(){
									if(this.getValue() == ''){
										Ext.getCmp('txtSecurityLabel').setValue(Cps.Locale.Dashboard1.all);
									}
								}
							}
						}, 
						{
							xtype: 'button',
							margin: '0 5 0 0',
							text: '',
							iconCls: 'iconSearch',
							handler: function () {
								popupSearch(2);
							},
						}, 
						{
							xtype: 'textfield',
							id: 'txtSecurityLabel',
							name: 'SecurityName',
							readOnly: true,
							fieldStyle: 'background: #EDEDED;',
							margin: '0 5 0 0',
							flex: 2,
							listeners: {
								afterrender: function() {
									setValueForm(this,'SecurityLabel');
								}
							}
						}
					]
				},
				{
					xtype: 'fieldcontainer',
					layout: 'hbox',
					items: [
						{
							xtype: 'radiogroup',
							id: 'rdoPosition',
							layout: 'vbox',
							flex: 1,
							defaults: {
								name: 'Position'
							},
							items: [
								{
									inputValue: Cps.Locale.Criteria.field4,
									boxLabel: Cps.Locale.Criteria.field4,
									checked: true
								},
								{
									inputValue: Cps.Locale.Criteria.field5,
									boxLabel: Cps.Locale.Criteria.field5
								}
							],
							listeners: {
								afterrender: function() {
									setValueForm(this,'Position');
								}
							}
						},
						{
							xtype: 'fieldcontainer',
							layout: 'vbox',
							flex: 1,
							items: [
								{
									/* On historic date checkboxfield*/
									xtype: 'checkboxfield',
									id: 'chkHistoryCheck',
									name: 'HistoryCheck',
									margin: '0 6 0 13',
									labelSeparator: '',
									hideLabel: true,
									boxLabel: Cps.Locale.Criteria.field6,
									fieldLabel: Cps.Locale.Criteria.field6,
									listeners: {
										change: function(checkbox, checked) {
											if (!checked)
												Ext.getCmp('dfHistoryDate').setValue('');
											Ext.getCmp('dfHistoryDate').setDisabled(!checked);
										},
										afterrender: function() {
											setValueForm(this,'HistoryCheck');
										}
									}
								}, 
								{
									/* History datefield */
									xtype: 'datefield',
									format: 'd/m/Y',
									maskRe: /([0-9]|\/)/,
									regex: /([0-9]|\/)/,
									id: 'dfHistoryDate',
									name: 'HistoryDate',
									margin: '0 6 0 13',
									fieldLabel: '',
									disabled: true,
									listeners: {
										afterrender: function() {
											setValueForm(this,'HistoryDate');
										}
									}
								}
							]
						}
					]
				},
				{
					xtype: 'checkboxfield',
					id: 'chkCheckCash',
					name: 'CheckCashAcount',
					labelSeparator: '',
					hideLabel: true,
					boxLabel: Cps.Locale.Criteria.field10,
					fieldLabel: Cps.Locale.Criteria.field10,
					listeners: {
						afterrender: function() {
							setValueForm(this,'CheckCash');
						}
					}
				},
				{
					xtype: 'checkboxfield',
					id: 'chkCheckPos',
					name: 'CheckPosSecurity',
					labelSeparator: '',
					hideLabel: true,
					boxLabel: Cps.Locale.Criteria.field11,
					fieldLabel: Cps.Locale.Criteria.field11,
					listeners: {
						afterrender: function() {
							setValueForm(this,'CheckPos');
						}
					}
				}
			]
		}
	],
	buttons: [
		{
			text: Cps.Locale.Criteria.btn1,
			handler: function (button) {
				var win= button.up('window');
				var form= win.down('form');
				if(form.isValid()){
					onDisplay(1);
				}
				else{
					Ext.MessageBox.alert(Cps.Locale.Criteria.title_warning, Cps.Locale.Criteria.content_warning);
				}
			}
		},
		{
			text: Cps.Locale.Criteria.btn2,
			handler: function() {
				this.ownerCt.ownerCt.close();
			}
		}
	]
});
function popupSearch(form) {
	if (form == 1)
	{
		var search1 = Ext.widget('Search');
		search1.show();
	}
	else if (form == 2)
	{
		var search1 = Ext.widget('Search1');
		search1.show();
	}
	else
	{
		var search1 = Ext.widget('Search2');
		search1.show();
	}
};
function onDisplay(place) {
	var combobox = Ext.getCmp('cbb'),
		combobox1 = Ext.getCmp('cbb1'),
		treepanel = Ext.getCmp('trp'),
		zone4 = Ext.getCmp('zone4'),
		//gridZone4 = Ext.getCmp('gridZone4'),
		width = 0;
	if (place == 1)
	{
		var criteriaForm = Ext.getCmp('criteria').down('form'),
			pnFilter = Ext.getCmp('pnFilter');
		
		var cbbDepositary = criteriaForm.down('#cbbDepositary'),
			hdfClientId = criteriaForm.down('#hdfClientId'),
			txtClientCode = criteriaForm.down('#txtClientCode'),
			txtClientName = criteriaForm.down('#txtClientName'),
			txtPortfolioCode = criteriaForm.down('#txtPortfolioCode'),
			txtPortfolioName = criteriaForm.down('#txtPortfolioName'),
			cbbEmployee = criteriaForm.down('#cbbEmployee'),
			cbbPool = criteriaForm.down('#cbbPool'),
			hdfSecurityId = criteriaForm.down('#hdfSecurityId'),
			txtSecurityCode = criteriaForm.down('#txtSecurityCode'),
			txtSecurityLabel = criteriaForm.down('#txtSecurityLabel'),
			rdoPosition = criteriaForm.down('#rdoPosition'),
			chkHistoryCheck = criteriaForm.down('#chkHistoryCheck'),
			dfHistoryDate = criteriaForm.down('#dfHistoryDate'),
			chkCheckCash = criteriaForm.down('#chkCheckCash'),
			chkCheckPos = criteriaForm.down('#chkCheckPos'),
			show = '', showForm = {};
		showForm = {
			Depositary: cbbDepositary.getValue(),
			ClientId: hdfClientId.getValue(),
			ClientCode: txtClientCode.getValue(),
			ClientName: txtClientName.getValue(),
			PortfolioCode: txtPortfolioCode.getValue(),
			PortfolioName: txtPortfolioName.getValue(),
			Employee: cbbEmployee.getValue(),
			Pool: cbbPool.getValue(),
			SecurityId: hdfSecurityId.getValue(),
			SecurityCode: txtSecurityCode.getValue(),
			SecurityLabel: txtSecurityLabel.getValue(),
			Position: rdoPosition.getValue(),
			HistoryCheck: chkHistoryCheck.checked,
			HistoryDate: dfHistoryDate.getRawValue(),
			CheckCash: chkCheckCash.checked,
			CheckPos: chkCheckPos.checked
		};
		sessionStorage.setItem('showForm', JSON.stringify(showForm));
		sessionStorage.setItem('filter', JSON.stringify(criteriaForm.getValues()));
		if (cbbDepositary.getValue() != Cps.Locale.Dashboard1.all && cbbDepositary.getValue() != '0' && cbbDepositary.getValue() != null && cbbDepositary.getDisplayValue() != '')
			show += Cps.Locale.Criteria.field1 + ' : <b>' + cbbDepositary.getValue() + ' - ' + cbbDepositary.getDisplayValue() + '</b> ; ';
		if (txtClientName.getValue() != Cps.Locale.Dashboard1.all)
			show += Cps.Locale.Criteria.field2 + ' : <b>' + txtClientCode.getValue() + ' - ' + txtClientName.getValue() + '</b> ; ';
		if (txtPortfolioName.getValue() != Cps.Locale.Dashboard1.all)
			show += Cps.Locale.Criteria.field3 + ' : <b>' + txtPortfolioCode.getValue() + ' - ' + txtPortfolioName.getValue() + '</b> ; ';
		if (cbbEmployee.getValue() != Cps.Locale.Dashboard1.all && cbbEmployee.getValue() != '0' && cbbEmployee.getValue() != null && cbbEmployee.getDisplayValue() != '')
			show += Cps.Locale.Criteria.field7 + ' : <b>' + cbbEmployee.getValue() + ' - ' + cbbEmployee.getDisplayValue() + '</b> ; ';
		if (cbbPool.getValue() != Cps.Locale.Dashboard1.all && cbbPool.getValue() != 0 && cbbPool.getValue() != null && cbbPool.getDisplayValue() != '')
			show += Cps.Locale.Criteria.field8 + ' : <b>' + cbbPool.getValue() + ' - ' + cbbPool.getDisplayValue() + '</b> ; ';
		if (txtSecurityLabel.getValue() != Cps.Locale.Dashboard1.all)
			show += Cps.Locale.Criteria.field9 + ' : <b>' + txtSecurityCode.getValue() + ' - ' + txtSecurityLabel.getValue() + '</b> ; ';
		show += 'Position : <b>' + rdoPosition.getValue().Position + '</b> ; ';
		chkHistoryCheck.checked ? show += Cps.Locale.Criteria.field6 + ' : <b>' + dfHistoryDate.getRawValue() + '</b> ; ' : '';
		chkCheckCash.checked ? show += '<b>' + Cps.Locale.Criteria.field10 + '</b> ; ' : '';
		chkCheckPos.checked ? show += '<b>' + Cps.Locale.Criteria.field11 + '</b> ; ' : '';
		show = show.substring(0, show.length - 2);
		pnFilter.update(show);
		Ext.getCmp('criteria').close();
		if (combobox.ownerCt.items.items[0].text != undefined)
			width = textWidth(combobox.ownerCt.items.items[0].text) + 20;
		else
		{
			if (Ext.isGecko)
				width = textWidth(combobox.ownerCt.items.items[0].textEl.dom.textContent) + 20;
			else
				width = textWidth(combobox.ownerCt.items.items[0].textEl.dom.innerText) + 20;
		}
		combobox.el.setStyle('left',width + 'px');
	}
	if (place != 3)
		sessionStorage.removeItem('groupers');
	var treeSelect = treepanel.getSelectionModel().getSelection();
	if (treeSelect.length > 0)
	{
		if (treeSelect[0].data.text != Cps.Locale.Dashboard1.node1)
		{
			if (zone4.items.items[0] != undefined)
			{
				zone4.items.items[0].destroy();
			}
			if (treeSelect[0].data.text == Cps.Locale.Dashboard1.node2)
				zone4.setTitle(Cps.Locale.Dashboard1.node2);
			else
			{	var chart = Ext.create('Cps.view.dashboard.Zone4', {
					params: null,
					panel: zone4
				}), node = 0;
				treeSelect[0].data.text == Cps.Locale.Dashboard1.node2_1 ? node = 1 :  treeSelect[0].data.text == Cps.Locale.Dashboard1.node2_2 ? node = 2 : node = 3;
				zone4.getHeader().items.getAt(1).show();
				zone4.setTitle(Cps.Locale.Dashboard1.node2 + " " + treeSelect[0].data.text.toLowerCase());
				switch (combobox1.getValue())
				{
					case "1":
						chart.initChart("Cps.chart.Column", node);
						break;
					case "2":
						chart.initChart("Cps.chart.Line", node);
						break;
					case "3":
						chart.initChart("Cps.chart.Pie", node);
						break;
					case "4":
						chart.initChart("Cps.chart.Bar", node);
						break;
					case "5":
						chart.initChart("Cps.chart.Area", node);
						break;
					case "6":
						chart.initChart("Cps.chart.Donut", node);
						break;
					case "7":
						chart.initChart("Cps.chart.Radial", node);
						break;
					case "8":
						chart.initChart("Cps.chart.Scatter", node);
						break;
				}
			}
		}
		else
		{
			if (zone4.items.items[0] != undefined)
			{
				if (place == 3)
				{
					var store = zone4.items.items[0].getStore(), itemsGroup = store.groupers.items, groupers = '';
					for ( var i = 0; i < itemsGroup.length; i++)
					{
						groupers += itemsGroup[i].property + ',' + itemsGroup[i].direction + ';';
					}
					groupers = groupers.substring(0, groupers.length - 1);
					sessionStorage.groupers = groupers;
				}
				zone4.items.items[0].destroy();
			}
			zone4.setTitle(Cps.Locale.Dashboard1.node1);
			zone4.getHeader().items.getAt(1).hide();
			var grid = Ext.create('Cps.view.dashboard.Zone4', {
				params: null,
				panel: zone4
			});
			switch (combobox.getValue())
			{
				case "1":
					grid.init("1","");
					break;
				case "2":
					grid.init("2","");
					break;
				case "3":
					grid.init("5","1");
					break;
				case "4":
					grid.init("5","2");
					break;
				case "5":
					grid.init("5","3");
					break;
			}
		}
	}
};
function getParam() {
	var value = {};
	value.center = 1;
	if (Ext.getCmp('centerManager') != undefined)
	{
		var items = Ext.getCmp('centerManager').menu.items.items;
		for (var i = 0; i < items.length; i++)
		{
			if (items[i].isHidden())//(items[i].iconEl != undefined && items[i].iconEl.dom.className.search('unchecked') < 0)
				value.center = items[i].value;
		}
	}
	return value;
};
function getParamPosition() {
    var values = getParam(), filter = JSON.parse(sessionStorage.getItem('filter')), pnFilter = Ext.getCmp('pnFilter');
	if (filter != null && pnFilter.html != undefined)
	{
		values.deposit = filter.Depositary == Cps.Locale.Dashboard1.all ? '' : parseInt(filter.Depositary);
		values.manager = filter.Employee == Cps.Locale.Dashboard1.all ? '' : filter.Employee;
		values.client = filter.ClientCode == '0' ? '' : parseInt(filter.ClientId);
		values.pool = filter.Pool == Cps.Locale.Dashboard1.all ? '' : parseInt(filter.Pool);
		values.security = filter.SecurityCode == '' ? '' : parseInt(filter.SecurityId);
		values.portfolio = filter.PortfolioCode == '0' ? '' : parseInt(filter.PortfolioCode);
		values.position = filter.Position == Cps.Locale.Criteria.field4 ? 1 : 2;
		values.status = 5;
		values.historical = filter.HistoryCheck == undefined ? false : true;
		if (values.historical)
		{
			if (filter.HistoryDate != undefined)
			{
				var initial = filter.HistoryDate.split(/\//);
				values.valuedate = initial[2] + '-' + initial[0] + '-' + initial[1];
			}
		}
		else
			values.valuedate = '';
			
		values.nilsecurity = filter.CheckPosSecurity == undefined ? false : true;
		values.nilfidu = '';
		values.nilcash = filter.CheckCashAcount == undefined ? false : true;
	}
	else
	{
		values.deposit = '';
		values.manager = '';
		values.client = 0;
		values.pool = '';
		values.security = '';
		values.portfolio = '';
		values.position = 2;
		values.status = 5;
		values.historical = false;
		values.valuedate = '2014-05-23';
		values.nilsecurity = false;
		values.nilfidu = false;
		values.nilcash = false;
	}
    return values;
};
function setValueForm(control, nameField) {
	var showForm = JSON.parse(sessionStorage.getItem('showForm')), pnFilter = Ext.getCmp('pnFilter'), filterContent;
	if (Ext.isGecko)
		filterContent = pnFilter.getEl().dom.lastChild.textContent;
	else
		filterContent = pnFilter.getEl().dom.lastChild.innerText;
	if (showForm != null && filterContent != '' && filterContent.trim() != 'Position : ' + Cps.Locale.Criteria.field4 + ' ;'&& filterContent.trim() != 'Position : ' + Cps.Locale.Criteria.field5 + ' ;')
	{
		if (nameField == 'HistoryCheck' && !showForm[nameField])
			control.setValue('');
		else if (showForm[nameField] != null)
			control.setValue(showForm[nameField]);
		else
			control.setValue(Cps.Locale.Dashboard1.all);
	}
	else
	{
		switch (nameField)
		{
			case 'Depositary':
				control.setValue(Cps.Locale.Dashboard1.all);
				break;
			case 'ClientId':
				control.setValue(0);
				break;
			case 'ClientCode':
				control.setValue(0);
				break;
			case 'ClientName':
				control.setValue(Cps.Locale.Dashboard1.all);
				break;
			case 'PortfolioCode':
				control.setValue(0);
				break;
			case 'PortfolioName':
				control.setValue(Cps.Locale.Dashboard1.all);
				break;
			case 'Employee':
				control.setValue(Cps.Locale.Dashboard1.all);
				break;
			case 'Pool':
				control.setValue(Cps.Locale.Dashboard1.all);
				break;
			case 'SecurityId':
				control.setValue(0);
				break;
			case 'SecurityCode':
				control.setValue('');
				break;
			case 'SecurityLabel':
				control.setValue(Cps.Locale.Dashboard1.all);
				break;
			case 'Position':
				control.setValue({Position: Cps.Locale.Criteria.field4});
				break;
			case 'HistoryCheck':
				control.setValue(false);
				break;
			case 'HistoryDate':
				control.setValue('');
				break;
			case 'CheckCash':
				control.setValue(false);
				break;
			case 'CheckPos':
				control.setValue(false);
				break;
		}
	}
}
